<?php include('pages/header.php') ?>

<table>
<tr>
<td>Фамилия</td>
<td>Имя</td>
<td>Отчество</td>
<td>Факультет</td>
<td>Группа</td>
<td>Комната</td>
<td>Оплата</td>
</tr>

<?php
$database = new PDO('sqlite:' . DBASEFILE);
if (!$database) {
    print("Database error.");
    return;
}

foreach ($database->query('SELECT * FROM People;') as $row) {
    print("<tr>" .
      "<td>{$row['lastname']}</td>" .
      "<td>{$row['name']}</td>".
      "<td>{$row['midname']}</td>" .
      "<td>{$row['faculty']}</td>" .
      "<td>{$row['gruppa']}</td>" .
      "<td>{$row['room']}</td>" .
      "<td>{$row['roomcost']}</td>" .
      "<td><a href=\"student.php?cmd=edit&id={$row['id']}\">Правка</a></td>" .
      "<td><a href=\"student.php?cmd=delete&id={$row['id']}\">Удалить</a></td>" .
      "</tr>"
    );
}

unset($database);
?>

</table>
<a href="student.php?cmd=add" title="ADD">Добавить</a>

<?php include('pages/footer.php'); ?>
